***************************************************************************************************
********************* Lasse Laustsen, 2021; Advances in Political Psychology***********************
************* Candidate Evaluations through the Lens of Adaptive Followership Psychology **********
***************************************************************************************************

*************************** Recodings of used variables *******************************************

*** Creates personality variable based on random assignment
recode Version (1 3 = 0 "Dominant") (2 4 = 1 "Non-Dominant") (else = .), generate(personality) label(personalityLB)

*** Recodes variables to 0-1 scales with 0 and 1 reflecting min. and max. values on variables
** Trait ratings on 7-point scales of the assigned personality description
**competence rating from this battery reported as no-context competence evaluation in article
recode spg13 (0=0) (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (else =.), generate(imødekommende6)
recode spg14 (0=0) (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (else =.), generate(stærkleder6)
recode spg15 (0=0) (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (else =.), generate(bekymre6)
recode spg16 (0=0) (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (else =.), generate(dominerende6)
recode spg17 (0=0) (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (else =.), generate(venlig6)
recode spg18 (0=0) (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (else =.), generate(konkurrence6)
recode spg19 (0=0) (1=1) (2=2) (3=3) (4=4) (5=5) (6=6) (else =.), generate(kompetent6)

generate agreeable = imødekommende6/6
generate strong_leader = stærkleder6/6
generate care = bekymre6/6
generate dominant = dominerende6/6
generate friendly = venlig6/6
generate competitive = konkurrence6/6
generate Competence = kompetent6/6

** Competence evalautions of assigned persoanlity in relation to Putin crisis scenario and financial crisis scenario, respectively.
recode spg21 (-99 = .), generate(CM_komp_Rusland10)
recode spg22 (-99 = .), generate(CM_komp_Samarbejde10)

generate Competence_PutinCrisis = CM_komp_Rusland10/10
generate Competence_FinancialCrisis = CM_komp_Samarbejde10/10



*************** Results reported for Context Prediction, Intergroup Conflict ***********************
*** Descriptive statistics for three competence evalautions
summ Competence Competence_PutinCrisis Competence_FinancialCrisis

*** Tests Competence evaluation for each of the three conditions/scenarios
** No-context evaluation
ttest Competence, by(personality)
** Putin-crisis scenario
ttest Competence_PutinCrisis, by(personality)
** Financial-crisis scenario
ttest Competence_FinancialCrisis, by(personality)


*** Tests if the relative rating of the assigned persoanlity differ significantly across contexts
** Creates difference variables between the three different contexts/competence evaluations
generate Putin_Financial = Competence_PutinCrisis - Competence_FinancialCrisis
generate Neutral_Financial = Competence - Competence_FinancialCrisis
generate Neutral_Putin = Competence - Competence_PutinCrisis

** tests if personality has different effects across contexts/conditions
ttest Putin_Financial, by(personality)
ttest Neutral_Financial, by(personality)
ttest Neutral_Putin, by(personality)


******************************** Figure 2 in article ********************************************
** Neutral / No-context condition, competence rating across persoanlity descriptions
reg Competence i.personality
margins, at(personality=(0 1))
marginsplot, recastci(rcap) ciopts(lpattern(solid)) recast(bar) yline(0) xlabel(#2) yscale(range(0 (0.2) 1)) ylabel(#5) ///
xtitle(Personality Description) ytitle(Competence Evaluation) title(Neutral Scenario) name("NoContext", replace)

** Financial Crisis Scenario
reg Competence_FinancialCrisis i.personality
margins, at(personality=(0 1))
marginsplot, recastci(rcap) ciopts(lpattern(solid)) recast(bar) yline(0) xlabel(#2) yscale(range(0 (0.2) 1)) ylabel(#5) ///
xtitle(Personality Description) ytitle(Competence Evaluation) title(Financial Crisis Scenario) name("FinancialCrisis", replace)

*Putin Conflict Scenario
reg Competence_PutinCrisis i.personality
margins, at(personality=(0 1))
marginsplot, recastci(rcap) ciopts(lpattern(solid)) recast(bar) yline(0) xlabel(#2) yscale(range(0 (0.2) 1)) ylabel(#5) ///
xtitle(Personality Description) ytitle(Competence Evaluation) title(Putin Crisis Scenario) name("PutinCrisis", replace)

graph combine NoContext FinancialCrisis PutinCrisis, col(3)
